﻿using System.Threading;

namespace NExt.Serialization.Core
{
    public static class IdGenerator
    {
        private const string IdFormat = "next-{0}";
        private static int ID;

        static IdGenerator()
        {
            ID = 0;
        }

        public static string GetId()
        {
            int id = Interlocked.Increment(ref ID);
            return string.Format(IdFormat, id);
        }

        public static void Reset()
        {
            ID = 0;
        }
    }
}
